package com.aboo.web.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.aboo.util.ContextBeanUtils;

/**
 * 加载ApplicationContext的监听器
 * @author Yata Aboo
 *
 */
public class ApplicationContextListener extends ContextLoaderListener {

	/**
	 * 覆盖监听器的初始化方法
	 */
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
		ServletContext sc = event.getServletContext();
		WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(sc);
		ContextBeanUtils.initialContext(wac);
	}	
	
}
